<div class="pop_up">
    <div class="pop_up_main">
        <div class="pop_up_tab">
            <div class="tab">
                <a href="#" class="on">基本设置</a>
            </div>
        </div>
        <div class="pop_up_box">
            <ul class="pop_up_box_form">
            	<li class="slide-param">
                    <div class="c1" style="width:100px;">视频地址：
                    </div>
                    <div class="c2" style="width:370px;">
						<input type="text" name="autoPlayInterval" id="video" class="param_post text in_mr5">(请输入完整地址)
                    </div>
                </li>
				<li class="slide-param">
                    <div class="c1" style="width:100px;">宽度：
                    </div>
                    <div class="c2" style="width:370px;">
						<input type="text" name="autoPlayInterval" id="width" class="param_post text in_mr5" value="300">(单位：像素)
                    </div>
                </li>
				<li class="slide-param">
                    <div class="c1" style="width:100px;">高度：
                    </div>
                    <div class="c2" style="width:370px;">
						<input type="text" name="autoPlayInterval" id="height" class="param_post text in_mr5" value="300">(单位：像素)
                    </div>
                </li><!--                <li>
                    <div class="c1">
                        缓存时间：
                    </div>
                    <div class="c2">
                     	<select name="u" id="cache_timeout" class="param_post text">
                        	<option value="60" >1分钟</option>
                            <option value="180">3分钟</option>
							<option value="300">5分钟</option>
							<option value="600"   selected="selected">10分钟</option>
							<option value="1800">30分钟</option>
                            <option value="3600">1小时</option>
                                                        <option value="0">不开启缓存</option>
                            
                        </select>
                    </div>
                </li>-->
            </ul>
        </div>
    </div>
    <div id="preview" class="preview_r">
    </div>
</div>
<script>
                                    	var index= '{$index}';
                                    	var layout = '{$layout}';
                                    	var parentId = '{$parentId}';
                                    	var id = '{$id}';
                                    	var namespace = '{$_GET['tagName']}';
                                		var postData = new Array();
										var imageLimit = new Array();
                               var defaultAttr = new Array();
                               var hasDefault = false;
            						<php>if(!empty($attr)){</php>
            							hasDefault = true;
            						<php>}</php>
            				
                            <volist name="attr" id="vo">
            						defaultAttr["{$key}"] = "{$vo}";
            				</volist>
							$(function(){
								for(var one in defaultAttr){
									//alert(defaultAttr[one]);
									$('#'+one).val(defaultAttr[one]);
								}
							});
                              function preview(){
                                var sendData = getPostData();
                                $.ajax({
                                    type: "POST",
                                    url: SITE_URL + '/index.php?app=page&mod=Diy&act=previewModel',
                                    data: sendData,
                                    dataType: 'json',
                                    success: function(result){
    								$('#preview').html(result.html);
                                        var content = '<div id="diy_copyHtmlContent">\
                                            		复制源代码:<input type="text" id="copyHtmlContent" onclick="select();" style="width:150px;" />\
                                        		</div>'
										var widget = '<div id="diy_copyHtmlContent">\
                                            		复制标签:<input type="text" id="copyWidgetContent" onclick="select();" style="width:150px;" />\
                                        		</div>'		
                                        $('#preview').append(content);
										$('#preview').append(widget);
                                        $('#copyHtmlContent').val(result.html);
										$('#copyHtmlContent').bind('click',function(){
											copyToClipboard(result.html);
										});
										$('#copyWidgetContent').val(result.widget);
										$('#copyWidgetContent').bind('click',function(){
											copyToClipboard(result.widget);
										});
                                    }
                                });
                            }
                                    	
                                    	function savemodel(){
                    						var sendData = getPostData();
                                			$.ajax({
                                				type : "POST",
                                				url  : SITE_URL + '/index.php?app=page&mod=Diy&act=saveModel',
                                				data : sendData,
                                				dataType : 'json',
                                				success : function(result){
                                 					//var jsonData = eval('('+result+')');
                                    		 		frameArray[parentId][layout][index] = result['sign'];
                                    		 		 if($('#'+id).html() == null){
                                			  		 $('#placeholder').html(result['html']);
                                    		 		 $('#placeholder')
                                    		 			.removeAttr('class')
                                    					.removeAttr('style')
                                    					.addClass('mb10')
                                    					.attr('id',id)
                                    					.attr('rel',namespace)
                                    		 			.prepend('<div class="diy_edit"><div class="ico_edit"><a href="javascript:void(0)" onclick="updateDiyModel(\''+id+'\',\''+namespace+'\')" class="ico_diyedit" title="设置">设置</a> <a href="javascript:void(0)" class="ico_diydel" onclick="deleteDiy(\'' + id + '\')" title="删除">删除</a></div></div>');
                            		        		 }else{
                            		    			 	$('#'+id).html(result['html']);
                            		    				$('#'+id).prepend('<div class="diy_edit"><div class="ico_edit"><a href="javascript:void(0)" onclick="updateDiyModel(\''+id+'\',\''+namespace+'\')" class="ico_diyedit" title="设置">设置</a> <a href="javascript:void(0)" class="ico_diydel" onclick="deleteDiy(\'' + id + '\')" title="删除">删除</a></div></div>');
                            		    
                            		    			 }
                                				}
                                			});
                                    	}
                                        function getPostData(){
                                            var style = $("#style").val();
                                            var data = new Array();
                                            var result = 'tagName=' + namespace;
											result += '&PARAM_video='+$('#video').val().replace(/&/g, "[@]");
											result += '&PARAM_width='+$('#width').val();
											result += '&PARAM_height='+$('#height').val();
                                            result += '&PARAM_style=default';
                                            return result;
                                        }

</script>